Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event-based Puzzles #47

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

tabascq
Copy link
Contributor

@tabascq tabascq commented Aug 29, 2018

Making puzzles be owned by events, as a way to play with object
relationships.

The "CLICK HERE TO CHECK YOUR DATABASE SETUP" link now points to Events
instead of Puzzles, and the Events index has a new link to access that
event's puzzle list.

I've needed to pass the event ID around, and the event ID should
probably be part of some global context, but this is a helpful microcosm
of issues we'll have when doing other features so I still think it's a
good start.

Making puzzles be owned by events, as a way to play with object
relationships.

The "CLICK HERE TO CHECK YOUR DATABASE SETUP" link now points to Events
instead of Puzzles, and the Events index has a new link to access that
event's puzzle list.

I've needed to pass the event ID around, and the event ID should
probably be part of some global context, but this is a helpful microcosm
of issues we'll have when doing other features so I still think it's a
good start.
Copy link
Contributor

@morganbr morganbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for figuring this event stuff out!

@@ -19,6 +19,7 @@
<th>
@Html.DisplayNameFor(model => model.Event[0].UrlString)
</th>
<!--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented out code.

@@ -27,17 +28,21 @@ public IActionResult OnGet()
[BindProperty]
public Puzzle Puzzle { get; set; }

public async Task<IActionResult> OnPostAsync()
public async Task<IActionResult> OnPostAsync(int? eventid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we require having an event id? We probably don't want puzzles that aren't in events

_context.Puzzle.Add(Puzzle);
await _context.SaveChangesAsync();

return RedirectToPage("./Index");
return RedirectToPage("./Index", new { eventid = eventid });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @asyasky, take a look at how we should be doing this (but no need to block on this)

{
Puzzle = await _context.Puzzle.ToListAsync();
if (eventid != null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an issue tracking removing the null tolerance since we don't want people accidentally wandering into all puzzles in all events

@tabascq
Copy link
Contributor Author

tabascq commented Aug 29, 2018

Changes made, thanks!

@tabascq tabascq merged commit c2b7db9 into PuzzleServer:master Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants